#include <iostream>
#define MAXN 100005
using namespace std;
int N, S;
int seq[MAXN];
void solve();
int main() {
    cin >> N >> S;
    for (int i = 0; i < N; i++) cin >> seq[i];
    solve();
}


// 还有一种方式是算区间之差
// 反复的计算
void solve() {
    int back = 0, res = MAXN, sum = 0;
    for (int i = 0; i < N; i++) {
        while (sum < S && back < N) {
            sum += seq[back]; back++;
        }
        if (sum >= S) res = min(res, back - i);
        else break;
        sum -= seq[i];
    }
    if (res == MAXN) cout << 0 << endl;
    else cout << res << endl;
}